package com.agent.common.entity;

import com.agent.common.constant.CommonConstants;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;

/**
 * 基础实体类
 * @author Jeff_Wan
 * @description 所有实体类的基类，包含公共字段
 */
@Data
public class BaseEntity {
    /**
     * 主键ID (雪花ID)
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 创建时间 (UTC格式)
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = CommonConstants.DATE_FORMAT_UTC, timezone = CommonConstants.TIME_ZONE_UTC)
    private LocalDateTime createdAt;

    /**
     * 更新时间 (UTC格式)
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = CommonConstants.DATE_FORMAT_UTC, timezone = CommonConstants.TIME_ZONE_UTC)
    private LocalDateTime updatedAt;
}